<#include "/includes/vars.inc">  
<@pp.dropOutputFile />
<#list entities.entity as entity>
    <@pp.changeOutputFile name="${webDir}/jeecode/"+entity.@name?uncap_first+"/"+entity.@name?cap_first+"View.xhtml" />
    <#assign entityName = entity.@name>
    <#assign managedBean = entity.@name?uncap_first+"Controller">
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="/template.xhtml">
        <ui:define name="body">
        	<ui:define name="metadata">
            	<f:metadata>
               		<f:event type="preRenderView" listener="${r"#{"}${managedBean}${r".refreshCurrent}"}" />
            	</f:metadata>
        	</ui:define>
	        <h:form>
	            <p:commandButton ajax="false"
	                             icon="ui-icon ui-icon-arrowreturnthick-1-w"
	                             <#if entity.@parent[0]??>
	                             action="/jeecode/${entity.@parent?uncap_first}/${entity.@parent}View.jsf"
	                             <#else>
	                             action="/jeecode/${entityName?uncap_first}/${entityName}Manage.jsf"
	                             </#if>
	                             value="${r"#{"}msg.back${r"}"}"/>
	        </h:form>
	        <p:spacer height="5" />
	
	        <p:tabView id="tab${entityName}">
	           
	            <p:tab title="${r"#{"}msg.${entityName?uncap_first}View${r"}"}">
	                <h:panelGroup id="data">
	                    <h:panelGrid columns="2" cellpadding="5">
	                        <ui:include src="/jeecode/${entityName?uncap_first}/include/${entityName}DataView.xhtml" />
	                    </h:panelGrid>
	                </h:panelGroup>
	            </p:tab>
	        	<ui:remove>
		            <p:tab title="${r"#{"}msg.${entityName?uncap_first}View${r"}"}">
		            	<h:form>
			            	<h:panelGroup id="data">
			                    <h:panelGrid columns="2" cellpadding="5">
			                        <ui:include src="/jeecode/${entityName?uncap_first}/include/${entityName}DataEdit.xhtml" />
			                    </h:panelGrid>
			                    <p:separator />
			                    <p:commandButton update="errors"
			                                     icon="ui-icon ui-icon-disk"
			                                     actionListener="${r"#{"}${managedBean}${r".save}"}"
			                                     value="${r"#{"}msg.save}"
			                                     />
			            	</h:panelGroup>
		            	</h:form>
		            </p:tab>
	            </ui:remove>
	            <!--  Relationships -->
	            
	            <#list entity["one-to-one"] as rel >
	            	<#if rel.@mappedBy??>
	            <p:tab title="${rel.@name?cap_first}">
	            	<h:form id="form${rel.@entity?cap_first}${entityName}OTO">
	                	<ui:include src="/jeecode/${rel.@entity?uncap_first}/include/${rel.@entity?cap_first}${entityName}OTO.xhtml" />
	            	</h:form>
	            </p:tab>
	            	</#if>
	            </#list>
	            <#--
	            <#list entity["many-to-one"] as rel >
	            <p:tab title="${rel.@name?cap_first}">
	                <ui:include src="/include/${entityName?uncap_first}/${entityName}${rel.@entity?cap_first}MTO.xhtml" />
	            </p:tab>
	            </#list>
	              -->
	            <#list entity["one-to-many"] as rel >
	             <p:tab title="${rel.@name?cap_first}">
	                <h:form id="form${rel.@entity}List">
	                    <ui:include src="/jeecode/${rel.@entity?uncap_first}/include/${rel.@entity}List.xhtml"/>
	                </h:form>
	                <h:form id="form${rel.@entity}Create">
	                    <ui:include src="/jeecode/${rel.@entity?uncap_first}/include/${rel.@entity}Create.xhtml" />
	                </h:form>
	                <h:form id="form${rel.@entity}Edit">
	                    <ui:include src="/jeecode/${rel.@entity?uncap_first}/include/${rel.@entity}Edit.xhtml" />
	                </h:form>
	                <h:form id="form${rel.@entity}Delete">
	                    <ui:include src="/jeecode/${rel.@entity?uncap_first}/include/${rel.@entity}Delete.xhtml"/>
	                </h:form>
	            </p:tab>
	            </#list>
	            <#list entity["many-to-many"] as rel >
	            <p:tab title="${rel.@name?cap_first}">
	                <h:form id="form${entityName}${rel.@entity?cap_first}MTM">
	                    <ui:include src="/jeecode/${entityName?uncap_first}/include/${entityName}${rel.@entity?cap_first}MTM.xhtml" />
	                </h:form>
	            </p:tab>
	            </#list>
	        </p:tabView>
	
	        <#--
	        <#list entity["one-to-one"] as rel >
	        <p:spacer height="5" />
	        <ui:include src="/include/${entityName?uncap_first}/${entityName}${rel.@entity?cap_first}OTO.xhtml" />
	        </#list>
	        <#list entity["many-to-one"] as rel >
	        <p:spacer height="5" />
	        <ui:include src="/include/${entityName?uncap_first}/${entityName}${rel.@entity?cap_first}MTO.xhtml" />
	        </#list>
	        <#list entity["one-to-many"] as rel >
	        <p:spacer height="5" />
	        <h:form id="form${entityName}${rel.@entity?cap_first}OTM">            
	            <ui:include src="/include/${entityName?uncap_first}/${entityName}${rel.@entity?cap_first}OTM.xhtml" />
	        </h:form>
	        </#list>
	        <#list entity["many-to-many"] as rel >
	        <p:spacer height="5" />
	        <h:form id="form${entityName}${rel.@entity?cap_first}MTM">
	            <ui:include src="/include/${entityName?uncap_first}/${entityName}${rel.@entity?cap_first}MTM.xhtml" />
	        </h:form>
	        </#list>
	        -->
        </ui:define>
    </ui:composition>
</html>

</#list>